package com.kzy.demoadmin.web.entity;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private String message;
    private Object data;
    
    // 成功响应
    public static Result success() {
        return new Result(200, "操作成功", null);
    }
    
    public static Result success(Object data) {
        return new Result(200, "操作成功", data);
    }
    
    public static Result success(String message, Object data) {
        return new Result(200, message, data);
    }
    
    // 失败响应
    public static Result error() {
        return new Result(500, "操作失败", null);
    }
    
    public static Result error(String message) {
        return new Result(500, message, null);
    }
    
    public static Result error(Integer code, String message) {
        return new Result(code, message, null);
    }

}